package com.example.file.io;

import java.io.*;

public class FileTest {
    public static void main(String[] args) throws Exception{
        File file = new File("C:\\Users\\hp\\Desktop\\ok\\10月\\messages_vi_VN.properties");
        FileInputStream fileInputStream = new FileInputStream(file);
        InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream,"utf-8");
        BufferedReader bufferedReader = new BufferedReader(inputStreamReader);

        File outFile = new File("C:\\Users\\hp\\Desktop\\ok\\10月\\messages_vi_VN.txt");
        FileOutputStream fileOutputStream = new FileOutputStream(outFile);
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream);
        BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter);

        String line;//代表一整行字符串
        while((line = bufferedReader.readLine()) != null){

            if (line.contains("&lt;") || line.contains("&gt;")) {
                System.out.println(line);
                bufferedWriter.write(line);
                bufferedWriter.newLine();//换行
            }
        }
        bufferedReader.close();
        bufferedWriter.close();//关闭流
    }
}
